package com.devinlee.designpatterns.factory.abstract_factory;

import com.devinlee.designpatterns.factory.abstract_factory.factory.BiyadiFactory;
import com.devinlee.designpatterns.factory.abstract_factory.factory.FushikangFactory;
import com.devinlee.designpatterns.factory.abstract_factory.product.Car;
import com.devinlee.designpatterns.factory.abstract_factory.product.Phone;

/**
 * 抽象工厂模式-测试
 *
 * 三种工厂模式特点：
 * 简单工厂模式：只有一个工厂，只生产一种产品
 * 工厂模式：多个工厂，只生产一种产品
 * 抽象工厂模式：多个工厂，而且生产多种产品
 */
public class Demo {

    public static void main(String[] args) {

        BiyadiFactory biyadiFactory = new BiyadiFactory();
        Car car1 = biyadiFactory.createCar();
        Phone phone1 = biyadiFactory.createPhone();
        car1.didi();
        phone1.start();

        FushikangFactory fushikangFactory = new FushikangFactory();
        Car car2 = fushikangFactory.createCar();
        Phone phone2 = fushikangFactory.createPhone();
        car2.didi();
        phone2.start();
    }
}
